package com.gali.juc;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @Auther: gali
 * @Date: 2022-08-18 16:43
 * @Description:
 */
public class CompletableFuture {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask<String> futureTask= new FutureTask<>(() -> {
            System.out.println("come in call()");
            return "hello callable";
        });

        Thread t1 = new Thread(futureTask,"t1");
        t1.start();
        System.out.println(futureTask.get());
    }

    class myThread2 implements Callable<String>{
        @Override
        public String call() throws Exception {
            System.out.println("come in call()");
            return "hello callable";
        }
    }


    class myThread1 implements Runnable{
        @Override
        public void run() {

        }
    }
}
